import { Body, Controller, Get, Post, Res } from "@nestjs/common";
import { OrderService } from "./order.service";
import { Response } from "express";

@Controller("order")
export class OrderController {
  constructor(private readonly orderService: OrderService) {}

  // Obtain all orders information
  @Get("/getAll")
  async getAll(@Res() res: Response): Promise<void> {
    return await this.orderService.getAll(res)
  }
  // Obtain all orders information with soft deletion
  @Get("/getAllWithDeleted")
  async getAllWithDeleted(@Res() res: Response): Promise<void> {
    return await this.orderService.getAllWithDeleted(res)
  }
  // Soft deletion orders
  @Post("/delete")
  async delete(@Body() body: any, @Res() res: Response): Promise<void> {
    return await this.orderService.delete(body, res)
  }
  // Real deletion orders
  @Post("/remove")
  async remove(@Body() body: any, @Res() res: Response): Promise<void> {
    return await this.orderService.remove(body, res)
  }
  // Batch delete orders with soft deletion
  @Post("/deleteGroup")
  async deleteGroup(@Body() body: any, @Res() res: Response): Promise<void> {
    return await this.orderService.deleteGroup(body, res)
  }
  // Batch delete orders with real deletion
  @Post("/removeGroup")
  async removeGroup(@Body() body: any, @Res() res: Response): Promise<void> {
    return await this.orderService.removeGroup(body, res)
  }
  // Soft clear orders of not paid
  @Post("/clear")
  async clear(@Res() res: Response): Promise<void> {
    return await this.orderService.clear(res);
  }
  // Search orders
  @Post("/search")
  async search(@Body() body: any, @Res() res: Response): Promise<void> {
    return await this.orderService.search(body, res)
  }
  // Search orders with soft deletion
  @Post("/searchWidthDeleted")
  async searchWithDeleted(
    @Body() body: any,
    @Res() res: Response
  ): Promise<void> {
    return this.orderService.searchWithDeleted(body, res)
  }
  // Restore orders
  @Post("/restore")
  async restore(@Body() body: any, @Res() res: Response): Promise<void> {
    return this.orderService.restore(body, res)
  }
  // Obtain platform income
  @Get("/count")
  async count(@Res() res: Response): Promise<void> {
    return await this.orderService.count(res)
  }
  // Obtain income trend
  @Get("/trend")
  async trend(@Res() res: Response): Promise<void> {
    return await this.orderService.trend(res)
  }
  // Obtain whether the specified order has been paid
  @Post("/isPaid")
  async isPaid(@Body() body: any, @Res() res: Response): Promise<void> {
    return this.orderService.isPaid(body, res)
  }
}
